<!--
 * @Author: xiaxia
 * @Description: 
 * @Date: 2024-06-24 16:22:00
 * @LastEditTime: 2024-07-22 14:04:49
 * @FilePath: \project\src\views\screen\index.vue
-->
<template>
  <div class="container">
    <div ref="screen" class="screen">
      <div class="top">
        <sceenTop/>
      </div>
      <div class="bottom">
        <div class="left">
          <person class="person"></person>
          <sex class="sex"></sex>
          <age class="age"></age>
        </div>
        <div class="center">
          <chinaMap class="chinaMap"></chinaMap>
          <thirty class="thirty"></thirty>
        </div>
        <div class="right">
          <hot class="hot"></hot>
          <tourist class="tourist"></tourist>
          <order class="order"></order>
        </div>
      </div>
    </div>
  </div>
</template>

<script lang="ts" setup>
import { ref, onMounted } from 'vue';
// 顶部
import sceenTop from './components/sceenTop/index.vue';
// 左侧
import sex from './components/sex/index.vue';
import person from './components/person/index.vue';
import age from './components/age/index.vue';
// 中间
import chinaMap from './components/chinaMap/index.vue';
import thirty from './components/thirty/index.vue';
// 右侧
import hot from './components/hot/index.vue';
import tourist from './components/tourist/index.vue';
import order from './components/order/index.vue';

let screen = ref()
onMounted(()=> {
  screen.value.style.transform =`scale(${getScale()}) translate(-50%,-50%)`
})
// 定义大屏缩放比例
function getScale(w=1920, h=1080) {
  let ww = window.innerWidth/w
  let wh = window.innerHeight/h
  return ww < wh ? ww : wh
}
window.onresize = () => {
  screen.value.style.transform = `scale(${getScale()}) translate(-50%,-50%)`
}
</script>

<style lang="scss" scoped>
.container{
  width: 100vw;
  height: 100vh;
  background: url(./images/bg.png) no-repeat;
  background-size: cover;

  .screen{
    position: fixed;
    width: 1920px;
    height: 1080px;
    left: 50%;
    top: 50%;
    transform-origin: left top;
    
    .top {
      width: 100%;
      height: 40px;
    }
    .bottom {
      display: flex;
      box-sizing: border-box;
      padding: 15px 40px;
      .left{
        flex: 1;
        height: 1010px;
        margin-right: 40px;
        display: flex;
        flex-direction: column;
        justify-content: space-between;
        box-sizing: border-box;
        color: #fff;

        .person {
          height: 37%;
          background: url('./images/dataScreen-main-lt.png') no-repeat;
          background-size: 100% 100%;
        }
        .sex {
          height: 30%;
          background: url('./images/dataScreen-main-lc.png') no-repeat;
          background-size: 100% 100%;
        }
        .age {
          height: 27%;
          background: url('./images/dataScreen-main-lb.png') no-repeat;
          background-size: 100% 100%;
        }
      }
      .center{
        flex: 2.5;
        display: flex;
        color: #fff;
        flex-direction: column;
        justify-content: space-between;
        box-sizing: border-box;
        .chinaMap {
          flex: 3;
          margin-top: 80px;
        }
        .thirty{
          flex: 1;
          background: url('./images/dataScreen-main-cb.png') no-repeat;
          background-size: 100% 100%;
        }
      }
      .right {
        flex: 1;
        height: 1010px;
        margin-left: 40px;
        display: flex;
        flex-direction: column;
        justify-content: space-between;
        box-sizing: border-box;
        color: #fff;

        .hot {
          height: 37%;
          background: url('./images/dataScreen-main-lt.png') no-repeat;
          background-size: 100% 100%;
        }
        .tourist {
          height: 30%;
          background: url('./images/dataScreen-main-lc.png') no-repeat;
          background-size: 100% 100%;
        }
        .order {
          height: 27%;
          background: url('./images/dataScreen-main-lb.png') no-repeat;
          background-size: 100% 100%;
        }
      }
    }
  }
}
</style>